#ifndef CONFIG_H
#define CONFIG_H

/*
Parser class for the config file.
Format:

KEY1=VAR1,VAR2,...,VARN\r\n
KEY2=VAR1,VAR2,...,VARN\r\n
.
.
.
*/

#define CFG_FILENAME    "./test.cfg"

#include <QObject>
#include <QFile>
#include <QTextStream>
#include <QStringList>

class Config:public QObject
{
    Q_OBJECT
public:
    Config(QObject* parent=0);
    Config(const QString& filename,QObject* parent=0);
    ~Config();

    QString getFilename()const;
    void setFilename(const QString& filename);
    void addVar(const QString& key,const QString& var);
    void addVar(const QString& key,const QStringList& vars);
    QStringList getVar(const QString& key);
    bool deleteFile();

private:
    QFile* file;
    QTextStream* textStream;

    void init(const QString& filename);

};

#endif // CONFIG_H
